package cn.wolfcode.controller;

import cn.wolfcode.domain.Banner;
import cn.wolfcode.service.IBannerService;
import cn.wolfcode.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IBannerService bannerService;


    @GetMapping("/banners/travel")
    public Object bannersTravel(){

        List<Banner> list = bannerService.queryBanner(Banner.TYPE_TRAVEL);
        return JsonResult.success(list);
    }

    @GetMapping("/banners/strategy")
    public Object bannersStrategy(){

        List<Banner> list = bannerService.queryBanner(Banner.TYPE_STRATEGY);
        return JsonResult.success(list.get(0));
    }

}
